package cn.tedu.csmall.order.webapi.mapper;

import cn.tedu.csmall.commons.pojo.order.model.OrderTbl;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public interface OrderMapper {
    //新增订单的Mapper方法
    @Insert("insert into order_tbl(user_id, commodity_code, count, money) " +
            "VALUES (#{userId},#{commodityCode},#{count},#{money})")
    void insertOrder(OrderTbl order);

    //分页查询订单的方法,虽然是分页查询，但是sql语言和普通查询一样，不用加limit关键字
    @Select("select id, user_id, commodity_code, count, money " +
            "from order_tbl")
    List<OrderTbl> findAllOrders();
}
